#ifndef ACTION_H
#define ACTION_H

#include "var.h"
#include <string>
#include <map>
#include <list>

namespace sde {

    class Action;
    class Object;
    
    typedef std::map<std::string, Action*> StringActionMap;
    typedef std::list<Action*> ActionList;

    class Action {
    public:
        static ActionList allActions;
    
        bool started, stopped;
        
        std::string initDepend;
        StringList destroyDepends;
    
        std::string archetype, name, type;
        Object* object;
        
        Action(std::string _type, std::string _name, Object* _object);
        Action(std::string _archetype, std::string _type, std::string _name, Object* _object);
        virtual ~Action();
        
        void doRun();
        void doStop();
        virtual void run() {}
        virtual void stop() {}
        
        void log(const char* fmt, ...);
        
        static ActionList getAllActionsOfArchetype(std::string _archetype);
        static Action* getFirstActionOfArchetype(std::string _archetype);
    };

}

#include "object.h"

#endif
